Show language: C# VB.NET Both

Boosting Page & Section Weight

HTML (ASPX etc)

Whole (or sections of) HTML pages may be boosted in weight using HTML comments, this means that the words will be treated as more important and push the page higher in the search results. Place a HTML comment immediately before the section (or entire page) that you want boosted in weight.

<!--keyoti_search_weight_boost_factor="2.8"-->
<p>all words from here to the end of the page will be weighted by 2.8x more than usual....

To reset the weight to normal, just set the boost factor to "1".

<!--keyoti_search_weight_boost_factor="3"-->
<p>all words in this section will be weighted by 3x more than usual.</p>
<!--keyoti_search_weight_boost_factor="1"-->
<p>all words in this section, to the end of the page will be weighted as usual.</p>

Note that the boost factor is converted to a single precision decimal, and should be greater than 0. Sections with a weight factor of "0" will not be ignored, but instead will result in the document being last in the results. To ignore a region, see this section.

All Document Types

Alternatively, word weighting can be modified in any document with a plug-in. Create a plug-in project using the index manager tool, and in the template find the code for the CalculateWordRelevancies event.

C#
private void CentralEventDispatcher_Action(object sender, Keyoti.SearchEngine.Events.ActionEventArgs e)
{
    if(e.ActionData.Name== ActionName.CalculateWordRelevancies)
    {

	System.Collections.ArrayList words = e.ActionData.Data as System.Collections.ArrayList;
	Document document = sender as Document;
	if (document.Uri.AbsolutePath.Contains("/important/"))
	{
		foreach (Word word2 in words)
		{
			word2.Weight *= 2; //boost the weight of all words by 2, if they're in the /important/ subdir.
		}
	}
}
VB.NET
Private Sub CentralEventDispatcher_Action(ByVal sender As Object,_
					ByVal e As Keyoti.SearchEngine.Events.ActionEventArgs)        
	If (e.ActionData.Name = ActionName.CalculateWordRelevancies) Then

		Dim words As System.Collections.ArrayList = CType(e.ActionData.Data,System.Collections.ArrayList)
		Dim document As Document
		document = CType(sender,Document)
		If document.Uri.AbsolutePath.Contains("/important/") Then
		 For Each word2 As Word In words
			 word2.Weight = (word2.Weight * 2)
			 'boost the weight of all words by 2, if they're in the /important/ subdir.
		 Next
		End If
 
	End If
End Sub

This code will boost all words by 2x that are in documents under the '/important' folder - but any criteria can be used, and specific words in the 'words' collection can be modified in weight.